﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;

namespace NewLife.YWS.Entities
{
    /// <summary>
    /// 维修保养记录
    /// </summary>
    [Serializable]
    [DataObject]
    [Description("维修保养记录")]
    [BindTable("Maintenance", Description = "维修保养记录", ConnName = "YWS")]
    public partial class Maintenance : YWSEntityBase<Maintenance>
    {
        #region 属性
        private Int32 _ID;
        /// <summary>
        /// 编号
        /// </summary>
        [Description("编号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn("ID", Description = "编号", DefaultValue = "", Order = 1)]
        public Int32 ID
        {
            get { return _ID; }
            set { if (OnPropertyChange("ID", value)) _ID = value; }
        }

        private Int32 _CustomerID;
        /// <summary>
        /// 客户编号
        /// </summary>
        [Description("客户编号")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn("CustomerID", Description = "客户编号", DefaultValue = "", Order = 2)]
        public Int32 CustomerID
        {
            get { return _CustomerID; }
            set { if (OnPropertyChange("CustomerID", value)) _CustomerID = value; }
        }

        private Int32 _MachineID;
        /// <summary>
        /// 机器编号
        /// </summary>
        [Description("机器编号")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn("MachineID", Description = "机器编号", DefaultValue = "", Order = 3)]
        public Int32 MachineID
        {
            get { return _MachineID; }
            set { if (OnPropertyChange("MachineID", value)) _MachineID = value; }
        }

        private String _Technician;
        /// <summary>
        /// 技术员
        /// </summary>
        [Description("技术员")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("Technician", Description = "技术员", DefaultValue = "", Order = 4)]
        public String Technician
        {
            get { return _Technician; }
            set { if (OnPropertyChange("Technician", value)) _Technician = value; }
        }

        private String _Reason;
        /// <summary>
        /// 故障原因
        /// </summary>
        [Description("故障原因")]
        [DataObjectField(false, false, true, 1073741823)]
        [BindColumn("Reason", Description = "故障原因", DefaultValue = "", Order = 5)]
        public String Reason
        {
            get { return _Reason; }
            set { if (OnPropertyChange("Reason", value)) _Reason = value; }
        }

        private String _Fittings;
        /// <summary>
        /// 更换配件
        /// </summary>
        [Description("更换配件")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn("Fittings", Description = "更换配件", DefaultValue = "", Order = 6)]
        public String Fittings
        {
            get { return _Fittings; }
            set { if (OnPropertyChange("Fittings", value)) _Fittings = value; }
        }

        private String _Propose;
        /// <summary>
        /// 改进建议
        /// </summary>
        [Description("改进建议")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn("Propose", Description = "改进建议", DefaultValue = "", Order = 7)]
        public String Propose
        {
            get { return _Propose; }
            set { if (OnPropertyChange("Propose", value)) _Propose = value; }
        }

        private String _Remark;
        /// <summary>
        /// 维修备注
        /// </summary>
        [Description("维修备注")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn("Remark", Description = "维修备注", DefaultValue = "", Order = 8)]
        public String Remark
        {
            get { return _Remark; }
            set { if (OnPropertyChange("Remark", value)) _Remark = value; }
        }

        private DateTime _AddTime;
        /// <summary>
        /// 添加时间
        /// </summary>
        [Description("添加时间")]
        [DataObjectField(false, false, true, 23)]
        [BindColumn("AddTime", Description = "添加时间", DefaultValue = "", Order = 9)]
        public DateTime AddTime
        {
            get { return _AddTime; }
            set { if (OnPropertyChange("AddTime", value)) _AddTime = value; }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "ID": return ID;
                    case "CustomerID": return CustomerID;
                    case "MachineID": return MachineID;
                    case "Technician": return Technician;
                    case "Reason": return Reason;
                    case "Fittings": return Fittings;
                    case "Propose": return Propose;
                    case "Remark": return Remark;
                    case "AddTime": return AddTime;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "ID": _ID = Convert.ToInt32(value); break;
                    case "CustomerID": _CustomerID = Convert.ToInt32(value); break;
                    case "MachineID": _MachineID = Convert.ToInt32(value); break;
                    case "Technician": _Technician = Convert.ToString(value); break;
                    case "Reason": _Reason = Convert.ToString(value); break;
                    case "Fittings": _Fittings = Convert.ToString(value); break;
                    case "Propose": _Propose = Convert.ToString(value); break;
                    case "Remark": _Remark = Convert.ToString(value); break;
                    case "AddTime": _AddTime = Convert.ToDateTime(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>
        /// 取得维修保养记录字段名的快捷方式
        /// </summary>
        public class _
        {
            ///<summary>
            /// 编号
            ///</summary>
            public const String ID = "ID";

            ///<summary>
            /// 客户编号
            ///</summary>
            public const String CustomerID = "CustomerID";

            ///<summary>
            /// 机器编号
            ///</summary>
            public const String MachineID = "MachineID";

            ///<summary>
            /// 技术员
            ///</summary>
            public const String Technician = "Technician";

            ///<summary>
            /// 故障原因
            ///</summary>
            public const String Reason = "Reason";

            ///<summary>
            /// 更换配件
            ///</summary>
            public const String Fittings = "Fittings";

            ///<summary>
            /// 改进建议
            ///</summary>
            public const String Propose = "Propose";

            ///<summary>
            /// 维修备注
            ///</summary>
            public const String Remark = "Remark";

            ///<summary>
            /// 添加时间
            ///</summary>
            public const String AddTime = "AddTime";
        }
        #endregion
    }
}